package com.monkey.controller;

import com.monkey.service.CommentsService;
import com.monkey.vo.Results;
import com.monkey.vo.params.CommentParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author：monkey-L
 * @description: .
 * @date: 14:59 2021/10/6
 */
@RestController
@RequestMapping("comments")
public class CommentsController {

    @Autowired
    private CommentsService commentsService;

    @GetMapping("article/{id}")
    public Results comments(@PathVariable("id") Long id) {
        return commentsService.commentsByArticleId(id);
    }

    @PostMapping("create/change")
    public Results comment(@RequestBody CommentParam commentParam){
        return commentsService.comment(commentParam);
    }
}
